//
// Created by user on 2025/7/30.
//

#ifndef HELLOC_COMBINED_H
#define HELLOC_COMBINED_H

#include "systemc"
#include <iostream>
using namespace std;
using namespace sc_core;

class Combined : public sc_module {
public:
    sc_event e1,e2,e3,e4,e5,e6,e7,e8,e9,e10;

    Combined(sc_module_name name) : sc_module(name) {
        SC_THREAD(trigger);
        SC_THREAD(catcher0);
        SC_THREAD(catcher1);
        SC_THREAD(catcher2);
        SC_THREAD(catcher3);
        SC_THREAD(catcher4);
        SC_THREAD(catcher5);
        SC_THREAD(catcher6);
    }


    void trigger(){
        e1.notify(1, SC_SEC);
        e2.notify(2, SC_SEC);
        e3.notify(3, SC_SEC);
        e4.notify(4, SC_SEC);
        e5.notify(5, SC_SEC);
        e6.notify(6, SC_SEC);
        e7.notify(7, SC_SEC);
        e8.notify(8, SC_SEC);
        e9.notify(9, SC_SEC);
        e10.notify(10, SC_SEC);
    }

    void catcher0(){
        wait(2, SC_SEC);
        cout<< sc_time_stamp() << ": 2sec timeout" << endl;
    }
    void catcher1(){
        wait(e1);
        cout<< sc_time_stamp() << ": catch e1" << endl;
    }

    void catcher2(){
        wait(e2 & e3);
        cout<< sc_time_stamp() << ": catch e2 & e3" << endl;
    }

    void catcher3(){
        wait(e4 | e5);
        cout<< sc_time_stamp() << ": catch e4 | e5" << endl;
    }

    void catcher4(){
        wait(sc_time(5,SC_SEC),e6);
        cout<< sc_time_stamp() << ": 5sec timeout or catch e6" << endl;
    }

    void catcher5(){
        wait(sc_time(20,SC_SEC),e7 | e8);
        cout<< sc_time_stamp() << ": 20sec timeout or catch e7 | e8" << endl;
    }

    void catcher6(){
        wait(sc_time(20,SC_SEC),e9 & e10);
        cout<< sc_time_stamp() << ": 20sec timeout or catch e9 & e10" << endl;
    }


};

#endif //HELLOC_COMBINED_H
